<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>几个有用的组件 :: 计算机组成原理实验指导</title>
    <meta name="generator" content="Antora 3.2.0-alpha.8">
    <link rel="stylesheet" href="../../_/css/site.css">
<!--    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> -->
  </head>
  <body class="article">
<header class="header">
  <nav class="navbar">
    <div class="navbar-brand">
      <a class="navbar-item" href="../..">计算机组成原理实验指导</a>
      <button class="navbar-burger" aria-controls="topbar-nav" aria-expanded="false" aria-label="Toggle main menu">
        <span></span>
        <span></span>
        <span></span>
      </button>
    </div>
    <div id="topbar-nav" class="navbar-menu">
      <div class="navbar-end">

        <div class="navbar-item">
          <span class="control">
            <a class="button is-primary" href="https://gitee.com/fpga-lab/digisimlab-open" target="_blank">Download</a>
          </span>
        </div>
      </div>
    </div>
  </nav>
</header>
<div class="body">
<div class="nav-container" data-component="digisimlab" data-version="1.1">
  <aside class="nav">
    <div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
  <nav class="nav-menu">
    <button class="nav-menu-toggle" aria-label="Toggle expand/collapse all" style="display: none"></button>
    <h3 class="title"><a href="index.html">计算机组成原理实验指导</a></h3>
<ul class="nav-list">
  <li class="nav-item" data-depth="0">
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="index.html">前言</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="0">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">Digital仿真软件使用指南</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-brief-introduction.html">简介</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="introduce-digitalsim.html">下载、安装及启动</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-getting-started.html">新手入门</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-generate-circuit.html">电路生成</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-test-circuit.html">电路测试</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-sim-dff.html">时序电路仿真</a>
  </li>
  <li class="nav-item is-current-page" data-depth="1">
    <a class="nav-link" href="ds-other-useful.html">几个有用的组件</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-hierarchical-design.html">层次化设计</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="ds-parametric-design.html">参数化设计</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="0">
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">基本逻辑电路</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/bl-multiplexer.html">多路选择器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/bl-decoder.html">译码器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/bl-register.html">触发器和寄存器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/bl-counter.html">计数器实验</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">运算电路</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/op-add_sub_operation.html">加减运算电路实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/op-arithmetic_logic_unit.html">算术逻辑单元实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/op-compare.html">比较运算电路实验</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">存储器</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/mem-rom.html">ROM实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/mem-ram.html">RAM实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/dp-register_file.html">寄存器堆实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/mem-path.html">存储器应用实验</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">数据通路</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/dp-overview.html">概述</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/dp-single_cycle_datapath.html">单周期数据通路实验（Ⅰ）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/dp-single_cycle_datapath-2.html">单周期数据通路实验（Ⅱ）</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">控制器</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/cu-overview.html">概述</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/cu-hardwire_controller-1.html">硬布线控制实验（Ⅰ）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/cu-hardwire_controller.html">硬布线控制实验（Ⅱ）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="lab/cu-hardwire_controller-3.html">硬布线控制实验（Ⅲ）</a>
  </li>
</ul>
  </li>
</ul>
  </li>
</ul>
  </nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
  <div class="context">
    <span class="title">计算机组成原理实验指导</span>
    <span class="version">1.1</span>
  </div>
  <ul class="components">
    <li class="component is-current">
      <div class="title"><a href="../index.html">计算机组成原理实验指导</a></div>
      <ul class="versions">
        <li class="version is-latest">
          <a href="../index.html">1.31</a>
        </li>
        <li class="version">
          <a href="../1.2/index.html">1.2</a>
        </li>
        <li class="version is-current">
          <a href="index.html">1.1</a>
        </li>
        <li class="version">
          <a href="../1.0/index.html">1.0</a>
        </li>
      </ul>
    </li>
  </ul>
</div>
    </div>
  </aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
  <a href="../index.html" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
  <ul>
    <li><a href="index.html">计算机组成原理实验指导</a></li>
    <li>Digital仿真软件使用指南</li>
    <li><a href="ds-other-useful.html">几个有用的组件</a></li>
  </ul>
</nav>
<div class="page-versions">
  <button class="version-menu-toggle" title="Show other versions of page">1.1</button>
  <div class="version-menu">
    <a class="version" href="../ds-other-useful.html">1.31</a>
    <a class="version" href="../1.2/ds-other-useful.html">1.2</a>
    <a class="version is-current" href="ds-other-useful.html">1.1</a>
    <a class="version" href="../1.0/ds-other-useful.html">1.0</a>
  </div>
</div>
</div>
  <div class="content">
<aside class="toc sidebar" data-title="页内目录" data-levels="2">
  <div class="toc-menu"></div>
</aside>
<article class="doc">
<h1 class="page">几个有用的组件</h1>
<div class="sect1">
<h2 id="_constant_value常量"><a class="anchor" href="#_constant_value常量"></a>Constant value/常量</h2>
<div class="sectionbody">
<div class="paragraph">
<p>该组件位于“Components/组件 ➤ Wire/导线 ➤ Constant value/常量”，用于提供一个常数。可以通过属性修改位宽和值。</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_splittermerger分解组合"><a class="anchor" href="#_splittermerger分解组合"></a>Splitter/Merger（分解/组合）</h2>
<div class="sectionbody">
<div class="paragraph">
<p>组件位置：“Components/组件 ➤ Wire/导线 ➤ Splitter/Merger（分裂器/合并器）”。该组件用于将一根多位的导线分成几个部分，或者反之将几个部分合并为一个整体。<a href="#fig-ds-splitter">图 1</a>给出了一个示例，4位二进制数 <code>1001</code> 分解为 <code>10</code> 和 <code>01</code>，然后重新组合为6位二进制数。分解、组合时各部分的顺序可以在属性中指定，例如<a href="#fig-ds-splitter">图 1</a>组合时将原4位的高2位与低2两位交换位置，并且高位用常数补充 <code>11</code>，结果为 <code>110110</code>。</p>
</div>
<div id="fig-ds-splitter" class="imageblock">
<div class="content">
<img src="_images/ds-splitter.png" alt="ds splitter">
</div>
<div class="title">图 1. 导线分解/组合示例</div>
</div>
<div class="paragraph">
<p>该组件需要设置“Input Splitting/输入分割”和“Output splitting/输出分割”两个属性。<a href="#fig-ds-splitter">图 1</a>两个组件的属性设置见<a href="#tab-ds-other-1">表 1</a>。
属性值可以是位数，也可以用位号。以Splitter为例，输入分割属性值为“4”，表示输入导线没有分割，是4位的；输出分割属性值为“2,2”，表示输出导线分割为两部分，每部分2位，按顺序排列下来就是“0-1”位和“2-3”位。也可以直接用位号设置输出分割属性值为“0-1,2-3”。
分割属性值用位数表示，就只能是按顺序显示。如果需要指定显示顺序，必须用位号表示，如<a href="#fig-ds-splitter">图 1</a>的Merger组件，导线的显示顺序依次为2-3，0-1，4-5。</p>
</div>
<div class="paragraph">
<p>输入分割和输出分割的总位数可以不相等，也就是可以只抽取其中一部分导线。例如从4位导线中只抽取最高位，输出分割属性值可以设为“3-3”。</p>
</div>
<table id="tab-ds-other-1" class="tableblock frame-all grid-all stretch">
<caption class="title">表 1. 属性设置举例</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-top"></th>
<th class="tableblock halign-center valign-top">Splitter</th>
<th class="tableblock halign-center valign-top">Merger</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-top"><p class="tableblock">Input Splitting/输入分割</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">4</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">2-3,0-1,4-5</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top"><p class="tableblock">Output splitting/输出分割</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">2,2 或 0-1,2-3</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">6</p></td>
</tr>
</tbody>
</table>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="提示"></i>
</td>
<td class="content">
更多用法可点击属性窗口内的“帮助”按钮。
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_sign_extender符号扩展"><a class="anchor" href="#_sign_extender符号扩展"></a>Sign extender（符号扩展）</h2>
<div class="sectionbody">
<div class="paragraph">
<p>组件位置：“Components/组件 ➤ Arithmetic/运算器 ➤ Sign extender/符号扩展器”。
如果需要将位宽较小的导线扩展为更大的位宽，并且保持符号位不变，就需要“Sign extender/符号扩展器”组件。该组件需要设置“输入位宽”和“输出位宽”两个属性，且输入位宽必须小于输出位宽。</p>
</div>
<div class="paragraph">
<p>虽然“Splitter/Merger”组件也可以扩展导线的位宽（见<a href="#fig-ds-splitter">图 1</a>示例），但是只能扩展固定的常数。而符号扩展器则是根据电路工作时的实际数据进行扩展，如果输入数据的最高位为“0”，扩展0；为“1”则扩展1。在计算机中，最高位表示带符号数的符号，故称为符号扩展。</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_probe探测器"><a class="anchor" href="#_probe探测器"></a>Probe（探测器）</h2>
<div class="sectionbody">
<div class="paragraph">
<p>组件位置：“Components/组件 ➤ IO/输入输出 ➤ Probe/探测器”。
该组件用于读取探测点的数值。<a href="#fig-ds-splitter">图 1</a>中有两个该组件的例子。
如果设置了“Label/标签”属性，那么仿真时其值可以显示在测量图表中。</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="提示"></i>
</td>
<td class="content">
即使“Probe/探测器”组件位于子电路中，测量图表中仍然可以显示其值，这对于观察子电路中的状态是非常有用的。
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_tunnel隧道"><a class="anchor" href="#_tunnel隧道"></a>Tunnel（隧道）</h2>
<div class="sectionbody">
<div class="paragraph">
<p>组件位置：“Components/组件 ➤ Wire/导线 ➤ Tunnel/隧道”。</p>
</div>
<div class="paragraph">
<p><a href="#fig-ds-tunnel">图 2</a>中两个三角形的组件就是隧道组件，这两个组件之间并没有导线连接，但是由于它们的名称相同，则意味着它们之间是连通的，只是表面看不见，就像有一条隧道把他们连接起来。</p>
</div>
<div id="fig-ds-tunnel" class="imageblock">
<div class="content">
<img src="_images/ds-tunnel.png" alt="ds tunnel">
</div>
<div class="title">图 2. 隧道示例</div>
</div>
<div class="paragraph">
<p>隧道的名称通过“Net name/网络名称”属性设置。在一张图中可以有多个同名的隧道，它们之间都是导通的。</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="注"></i>
</td>
<td class="content">
隧道可以减少复杂电路图的连线，使外观更整洁；但是也给读图和检查电路带来不便，不应过度使用。
</td>
</tr>
</table>
</div>
<div class="sidebarblock text-center">
<div class="content">
<div class="title">许可 | License</div>
<div class="paragraph">
<p><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA：署名-非商业性使用-相同方式共享 4.0 国际许可协议</a></p>
</div>
<div class="paragraph">
<p>作者：
肖铁军 &lt;<a href="mailto:xiaotiejun@foxmail.com.cn">xiaotiejun@foxmail.com.cn</a>&gt;</p>
</div>
</div>
</div>
</div>
</div>
</article>
  </div>
</main>
</div>
<footer class="footer">
  <p>This page was built using the Antora default UI.</p>
  <p>The source code for this UI is licensed under the terms of the MPL-2.0 license.</p>
</footer>
<script id="site-script" src="../../_/js/site.js" data-ui-root-path="../../_"></script>
<script async src="../../_/js/vendor/highlight.js"></script>
  </body>
</html>
